package com.example.nettywebsocketdemo.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

/**
 * @Author: ZhaoJie
 * @Date: 2022/3/29
 * @Description :
 * @Modify :
 * ===================================================
 * Modifier        Modifytime        Description
 * ===================================================
 */
public class App {
    public static <car> void main(String[] args) {
        CarInterface car = new Car();
        // 获取代理对象
        CarInterface car2 = (CarInterface) Proxy.newProxyInstance(car.getClass().getClassLoader(), Car.class.getInterfaces(), new InvocationHandler() {

            @Override
            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                return null;
            }
        });
        car2.run();
        String carName = car2.carName("比亚迪");
        System.out.println("carName:" + carName);
    }
}
